package Thread;

public class Demo12 {
    // 线程的所有状态
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {

                System.out.println("hello thread.");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

        });

        System.out.println(t.getState()); // NEW
        t.start();
        System.out.println(t.getState()); // RUNNABLE
        Thread.sleep(500);
        System.out.println(t.getState()); // TIMED_WAITING

        t.join();
        System.out.println(t.getState()); // TERMINATED
    }
}
